<template>
    <!-- <i class="svg-icon-container">
        <svg
            aria-hidden="true"
            class="svg-icon"
            :style="'width:' + aSize + 'px ;height:' + aSize+'px'"
        >
            <use :xlink:href="symbolId" :fill="aColor" />
        </svg>
    </i> -->

    <svg
        aria-hidden="true"
        class="svg-icon-container"
        :style="'width:' + aSize + 'px ;height:' + aSize + 'px'"
    >
        <use :xlink:href="symbolId" :fill="aColor" />
    </svg>
</template>
<script setup lang="ts">
import { computed } from "vue";
//#region defineXxx
defineOptions({
    name: "svg_icon",
});

const props = defineProps({
    aIcon: {
        type: String,
        required: false,
        default: "",
    },
    aColor: {
        type: String,
        default: "",
    },
    aSize: {
        type: Number,
        default: 14,
    },
    aPrefix: {
        type: String,
        default: "icon",
    },
});

const symbolId = computed(() => `#${props.aPrefix}-${props.aIcon}`);

//#endregion
</script>
<style lang="scss" scoped>
// .svg-icon-container{
//     display: inline-block;
// }
.svg-icon-container {
    display: inline-block;
    width: 1em;
    height: 1em;
    overflow: hidden;
    vertical-align: -0.15em; /* 因icon大小被设置为和字体大小一致，而span等标签的下边缘会和字体的基线对齐，故需设置一个往下的偏移比例，来纠正视觉上的未对齐效果 */
    outline: none;
    fill: currentcolor; /* 定义元素的颜色，currentColor是一个变量，这个变量的值就表示当前元素的color值，如果当前元素未设置color值，则从父元素继承 */
}
</style>
